import axios from 'axios'

const instance = axios.create({
    timeout: 20000 // 请求超时时间
})

// request拦截器
instance.interceptors.request.use(config => {
    config.headers['X-Token'] = localStorage.getItem('sessionid') || '';
    return config
}, error => {
    Promise.reject(error)
})

// respone拦截器
instance.interceptors.response.use(
    response => {
        return response.data;
    },
    error => {
        return Promise.reject(error)
    }
)

function findStudentRegisterInfo(searchType) {
    return instance({
        url: '/api/studentservice/studentRegister/findStudentRegisterInfo',
        method: 'get',
        params: {
            type: searchType
        }
    });
}

const screenApi = {
    'findStudentRegisterInfo': findStudentRegisterInfo,
}

export default screenApi;